home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Stuff / 3D_Reality / 3D_Reality_API / Examples / 3DDebugUtilities.bproj / DebuggingExtensions.m < prev    next >
Encoding:
Text File  |  1992-10-25  |  1.0 KB  |  50 lines

  1. #import <3Dreality_api.h>
  2. #import "DebugMethods.h"
  3. #import "DebuggingExtensions.h"
  4.  
  5. @implementation Camera (Camera_ResponderMethods)
  6. - dbg_dumpShapeHierarchy:sender
  7. {
  8.     id currentCamera=[Camera currentCamera];
  9.     id shape = [currentCamera selectedShape];
  10.     [currentCamera dumpHierarchyFrom:shape atDepth:[shape shapeDepth]];
  11.     return self;
  12. }
  13.  
  14. - dbg_dumpWorldHierarchy:sender
  15. {
  16.     id currentCamera=[Camera currentCamera];
  17.     [currentCamera dumpHierarchyFromWorldShape];
  18.     return self;
  19. }
  20. @end
  21.  
  22. @implementation Camera (debug_methods)
  23. void spaces(int d)
  24. {
  25.     int i;
  26.     for(i=0;i<d;i++)
  27.     fprintf(stderr, "  ");
  28. }
  29. - dumpHierarchyFrom:shape atDepth:(int) d
  30. {
  31.     id s = shape;
  32.  
  33.     spaces(d);
  34.     fprintf(stderr, "%s\n", [shape shapeName]);
  35.  
  36.     if([s descendant])
  37.     [self dumpHierarchyFrom:[s descendant] atDepth:d+1];
  38.     if([s nextPeer])
  39.     [self dumpHierarchyFrom:[s nextPeer] atDepth:d];
  40.     
  41.     return self;
  42. }
  43.  
  44. - dumpHierarchyFromWorldShape
  45. {
  46.     [self dumpHierarchyFrom:[self worldShape] atDepth:0];
  47.     return self;
  48. }
  49. @end
  50.